const hprose = require('hprose');
const service = new hprose.HttpService();
const hproseUtil = require('../util/hproseUtil');
const ModelProxy = require('../util/modelProxy');
Object.keys(think.app.models).forEach(model => {
  hproseUtil.scanMethods(service, new ModelProxy(model, think.model(model)), think.camelCase(model));
});
module.exports = (options, app) => {
  return (ctx, next) => {
    return service.handle(ctx.req, ctx.res).then(_ => {}).catch(_ => {});
  };
};
